package com.mystudy.controller;

import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lihai
 * @Description
 * @create 2022/1/27 -22:15
 */
@Controller
public class Mycontorller {
    /**
     * 处理请求
     */
    @RequestMapping(value = "/some.do")
    public ModelAndView dosom(HttpServletRequest request){

        ModelAndView mv = new ModelAndView();
        mv.addObject("msg","欢迎使用springmvc开发"+request.getParameter("name"));
        mv.addObject("func","执行了dosome方法");

        mv.setViewName("some");

        return mv;
    }
    @RequestMapping(value = "/paramas.do",method = RequestMethod.GET)
    public ModelAndView getParams(String name,int age){
        ModelAndView mv = new ModelAndView();
        mv.addObject("myname",name);
        mv.addObject("myage",age);
        mv.setViewName("some");
        return mv;
    }
}
